#!groovy
pipeline {
	agent  any
	tools{
        maven 'maven'
    }
	environment {
		REPOSITORY = 'http://192.168.50.251/svn/ipstation/branches/CMS/0725/baby-admin'
		MODULE = 'baby-supply'
		SCRIPTS_PATH = '/home/new_disk/scripts'
	}

	stages {
		stage('获取代码') {
		    //agent  { label 'master' }
			steps {
				echo "start fetch code svn:${REPOSITORY}"
				deleteDir()
				
			    checkout([$class: 'SubversionSCM', additionalCredentials: [], excludedCommitMessages: '', excludedRegions: '', excludedRevprop: '', excludedUsers: '', filterChangelog: false, ignoreDirPropChanges: false, includedRegions: '', locations: [[cancelProcessOnExternalsFail: true, credentialsId: '9a9b38e6-beb8-433e-a889-c86b9e074a3a', depthOption: 'infinity', ignoreExternalsOption: true, local: '.', remote: "${REPOSITORY}"]], quietOperation: true, workspaceUpdater: [$class: 'UpdateUpdater']])
			}
		}
	
		stage('部署服务') {
		    agent  { label '207_stg' }
			steps {
			    script{
			    	echo '123456789'
    			 	//sh "docker version"
			    }
			    
			}
		}
		
		stage('test') {
		   // agent  any
		   agent  { label 'master' }
			steps {
			    script{
			    	echo '999999989'
    			 	//sh "docker version"
			    }
			    
			}
		}
		
	}
	post {
    	failure {
    		 emailext body: """${env.JOB_NAME}-Build # ${env.BUILD_NUMBER} - ${currentBuild.result?:'SUCCESS'}
    		 :Check console output at ${env.BUILD_URL} to view the results""", 
        recipientProviders: [requestor()], 
        subject: "${env.JOB_NAME}-Build # ${env.BUILD_NUMBER} - ${currentBuild.result?:'SUCCESS'}!",
        attachLog: true
    	}
    }
}